package cn.js.controller;


import cn.js.dto.User;
import cn.js.feign.UserFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/pay")
public class PayController {

    @Autowired
    private UserFeignClient userFeignClient;

    @GetMapping("/getUserById/{id}")
    public User getUserById(@PathVariable Long id){
        //通过 UserFeignClient Feign的客户端接来调用用户服务，获取User并返回，此时这样的写法才够优雅
        return userFeignClient.getById(id);
    }
}
